#ifndef RUNQUT_H
#define RUNQUT_H

#include <QObject>

#include <QList>
#include <QString>
#include <QStringList>
#include <QUrl>

#include <quick/QutSummary.h>
class QutRunner;

typedef QPair<QString, QString> StringPair;
typedef QList<StringPair> StringPairList;

class RunQUT : public QObject
{
    Q_OBJECT

public:
    enum StdoutFlags
    {
        None        = 0x00000000,
        Silent      = 0x00000001,
        Summary     = 0x00000002,
        Fatal       = 0x00000004,
        Assert      = 0x00000010,
        Expect      = 0x00000020,
        Progress    = 0x00000040,
        Pass        = 0x00000080,
        All         = 0x00000100,
        Sequential  = 0x80000000,
    };

public:
    explicit RunQUT(QObject * parent=0);

private:
    void showEvents(void);

signals:
    void initialized(void);
    void commandsProcessed(void);
    void nothing(void);
    void started(void);
    void libraryTested(QutCase::Level level);
    void doneTesting(void);
    void finished(void);
    void resultsFinished(void);
    void reportFinished(void);

public slots:

private slots:
    void initialize(void);
    void processCommands(void);
    void start(void);
    void nextLibrary(void);
    void processTestCase(QutCase);
    void libraryFinish(void);
    void finish(void);
    void results(void);
    void report(void);
    void leave(void);

private:
    QutSummary _summary;
    QStringList libNames_qsl;
    QUrl blog_url;
    QUrl results_url;
    QUrl report_url;
    int stdout_flags;
    StringPairList libName_error_spl;
    QTextStream mStdout;
    QutCase::Level mMax_level;
    int mLastEventIndex;
};

#endif // RUNQUT_H
